#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
vector<int> a[N];
ll p = 0, q = 1;
ll count(int i, int j) {
  if (a[i].size() > a[j].size()) swap(i, j);
  ll res = 0;
  for (int x : a[i]) {
    res += upper_bound(a[j].begin(), a[j].end(), x) -
           lower_bound(a[j].begin(), a[j].end(), x);
  }
  return res;
}
void chmax(ll& p, ll& q, ll u, ll v) {
  if (p * v < u * q) p = u, q = v;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) {
    int x, y;
    cin >> x;
    a[i] = vector<int>(x, 0);
    rep(j, 0, x - 1) cin >> a[i][j];
  }
  rep(i, 1, n) sort(a[i].begin(), a[i].end());
  rep(i, 1, n) rep(j, i + 1, n) {
    ll u = count(i, j);
    ll v = 1ll * a[i].size() * a[j].size();
    chmax(p, q, u, v);
  }
  cout << fixed << setprecision(10) << 1.0 * p / q;
  return 0;
}